package com.chagee.channel.api.service;

import com.chagee.base.utils.SoaResponse;
import com.chagee.channel.api.bo.lark.*;

import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import lombok.SneakyThrows;

/**
 * 飞书相关接口
 *
 * @author: chang.jiawei
 * @date: 2024/01/18
 */

public interface ILarkServiceApi {

    /**
     * 上传文件至飞书,用于审批
     *
     * @param uploadFile 文件
     * @return 文件地址与code
     */
    SoaResponse<FileUploadResultBO, String> uploadFile(@Valid UploadFileBO uploadFile);

    /**
     * 上传文件至飞书,用于审批
     *
     * @param uploadFile 文件
     * @return 文件地址与code
     */
    SoaResponse<FileUploadResultBO, String> uploadFileWithUrl(@Valid UploadFileUrlBO uploadFile);

    /**
     * 上传文件至飞书与oss
     *
     * @param uploadFile 文件
     * @return 文件地址与code
     */
    @SneakyThrows
    SoaResponse<FileUploadWithOssResultBO, String> uploadLarkAndOssWithUrl(@Valid UploadFileUrlBO uploadFile);

    /**
     * 触发审批
     *
     * @param startApprovalBO 审批内容
     * @return 审批的实例id
     */
    SoaResponse<String, Void> startApprove(@Valid StartApprovalBO startApprovalBO);

    /**
     * 通过审批
     *
     * @param approveApprovalBO 审批内容
     * @return 审批的实例id
     */
    SoaResponse<Void, Void> approveApprove(@Valid ApproveApprovalBO approveApprovalBO);

    /**
     * 撤销审批
     *
     * @param revokeApprovalBO 审批内容
     * @return 审批的实例id
     */
    SoaResponse<Void, Void> revokeApprove(@Valid RevokeApprovalBO revokeApprovalBO);

    /**
     * 审批实例详情
     * @param instanceCode  实例code
     * @return 审批实例详情
     */
    SoaResponse<ApprovalInstanceDetailBO, Void> approvalInstanceDetail(@Valid @NotBlank(message = "审批实例code不能为空！") String instanceCode);

    /**
     * 审批流程预览
     * @param previewApprovalBO  参数
     * @return 审批实例详情
     */
    SoaResponse<List<ApprovalPreviewNodeBO>, Void> approvalInstancePreview(@Valid PreviewApprovalBO previewApprovalBO);

    /**
     * 审批模板详情
     * @param approvalCode  审批模板code
     * @return 审批实例详情
     */
    SoaResponse<ApprovalDetailBO, Void> approvalDetail(@Valid @NotBlank(message = "审批模板code不能为空！") String approvalCode);

    /**
     * 审批评论详情
     * @param request
     * @return 审批实例详情
     */
    SoaResponse<ApprovalCommentListResponse, Void> approvalCommentsList(@Valid ApprovalCommentListRequest request);

	/**
	 * 审批实例详情-全文评论
	 *
	 * @param instanceCode
	 * @return
	 */
	SoaResponse<ApprovalCommentsBO, Void> approvalInstanceComment(String instanceCode);

    /**
     * 审批单抄送
     * @param request request
     * @return 审批单抄送
     */
    SoaResponse<ApprovalCarbonCopyResponse, Void> approvalCarbonCopy(@Valid ApprovalCarbonCopyRequest request);
}
